package com.wb.service;

import com.wb.bean.User;
import com.wb.dao.UserRepository;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service(value = "userService")
public class UserService implements IUserService {

    @Resource(name = "userRepository")
    private UserRepository userRepository;

    @Override
    public User queryUserById(Long id) {
//        return userRepository.findOne(id);
        return new User();
    }

    @Override
    public boolean saveUser(User user) {
        User result = userRepository.save(user);
        return null == result ? true : false;
    }

    @Override
    public List<User> queryAll() {
        return userRepository.findAll();
    }
}
